<!DOCTYPE html>
<html class="no-js" lang="zh">
<head>
  <meta charset="utf-8" />
  <meta http-equiv="x-ua-compatible" content="ie=edge" />
  <title>615MC | 错误页面</title>
  <meta name="description" content="错误页面展示" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <link rel="shortcut icon" type="image/x-icon" href="./logo.png" />
  
  <!-- ========================= CSS here ========================= -->
  <link rel="stylesheet" href="assets/css/bootstrap-5.0.0-beta2.min.css" />
  <link rel="stylesheet" href="assets/css/LineIcons.2.0.css" />
  <link rel="stylesheet" href="assets/css/tiny-slider.css" />
  <link rel="stylesheet" href="assets/css/animate.css" />
  <link rel="stylesheet" href="assets/css/main.css" />
  <style>
    body {
      background-color: #222;
      color: white;
      text-align: center;
      padding: 20px;
    }
    h1, h2, p {
      margin: 10px 0;
    }
    .error-title {
      font-size: 36px;
      color: white;
    }
    .error-message {
      font-size: 18px;
      color: #bbb;
    }
  </style>
</head>

<body>
  <!-- ========================= Hero section start ========================= -->
  <section id="home" class="hero-section">
    <div class="container">
      <div class="row align-items-center">
        <div class="col-12">
          <h1 id="error-code">404</h1>
          <h2 id="error-title" class="error-title">页面未找到！</h2>
          <p id="error-message" class="error-message">The page you are looking for does not exist!</p>
        </div>
      </div>
    </div>
  </section>
  <!-- ========================= Hero section end ========================= -->

  <!-- ========================= Footer start ========================= -->
  <footer class="footer pt-160">
    <div class="container">
      <div class="row">
        <div class="col-12">
          <p>615mc | 错误页面</p>
        </div>
      </div>
    </div>
  </footer>
  <!-- ========================= Footer end ========================= -->

  <!-- ========================= JS here ========================= -->
  <script>
    // 定义 HTTP 状态码和对应的错误信息
    const httpStatus = {
      '400': '错误请求 (Bad Request)',
      '401': '未授权 (Unauthorized)',
      '403': '禁止访问 (Forbidden)',
      '404': '未找到 (Not Found)',
      '405': '方法不被允许 (Method Not Allowed)',
      '500': '服务器内部错误 (Internal Server Error)',
      '502': '错误网关 (Bad Gateway)',
      '503': '服务不可用 (Service Unavailable)',
      '504': '网关超时 (Gateway Timeout)',
      '505': 'HTTP 版本不支持 (HTTP Version Not Supported)',
      '666': '服务器正在更新....',
      // 可以添加更多状态码...
    };

    // 获取 URL 中的 "code" 参数值
    const urlParams = new URLSearchParams(window.location.search);
    const errorCode = urlParams.get('code') || '404'; // 默认值为 404

    // 获取对应的错误信息
    const errorTitle = httpStatus[errorCode] || '未知错误 (Unknown Error)';
    const errorMessage = `HTTP 状态码 ${errorCode}: ${errorTitle}`;

    // 更新页面内容
    document.getElementById('error-code').textContent = errorCode;
    document.getElementById('error-title').textContent = errorTitle;
    document.getElementById('error-message').textContent = errorMessage;

    // 如果状态码为 200，重定向到首页
    if (errorCode === '200') {
      window.location.href = '/';
    }
  </script>
</body>
</html>
